#ifndef __PULSEAUDIOUTILS__H__
#define __PULSEAUDIOUTILS__H__

#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <stdbool.h>

#include <pulse/simple.h>
#include <pulse/error.h>

#define INFO_LOG(format, args...)   \
    printf(__FILE__ ": " format "\n", ##args);

void createPulseSampleSpecification(pa_sample_spec *sample_spec, 
                                    pa_sample_format_t format, 
                                    uint32_t rate, uint8_t channels);

bool createPulseSimpleRecord(pa_simple **sample, pa_sample_spec *sample_spec);

bool createPulseSimplePlay(pa_simple **sample, pa_sample_spec *sample_spec);

void destroyPulseSimple(pa_simple **simple);

bool readPulseSimple(pa_simple *simple, char *buffer, size_t buffer_size);

bool writePulseSimple(pa_simple *simple, char *buffer, size_t buffer_size);

bool waitPulseSimplePlayed(pa_simple **simple);

#endif  //!__PULSEAUDIOUTILS__H__